<?php
/************************************************************************
 Omnitrix - PHP Development Framework
 Copyright (C) 2012-2018 amonest(eastson@outlook.com)

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
************************************************************************/

class admin_controller_phpinfo extends omnitrix_controller
{
	public function index_action()
	{
		ob_start();
		phpinfo();
		$php_info = ob_get_clean();

		$php_style = <<<EOT
<style type="text/css">
.php-info td, .php-info th, .php-info h1, .php-info t2 {font-family: sans-serif;}
.php-info table {width: 100%; border-collapse: collapse;}
.php-info td, .php-info th {padding: 3px; border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
.php-info td.e {min-width: 250px;}
.php-info pre {margin: 0px; font-family: monospace;}
.php-info a:link {color: #000099; text-decoration: none; background-color: #ffffff;}
.php-info a:hover {text-decoration: underline;}
.php-info .center {text-align: center;}
.php-info .center table { margin-left: auto; margin-right: auto; text-align: left;}
.php-info .center th { text-align: center !important; }
.php-info h1xx {font-size: 150%;}
.php-info h2xx {font-size: 125%;}
.php-info .p {text-align: left;}
.php-info .e {background-color: #ccccff; font-weight: bold; color: #000000;}
.php-info .h {background-color: #9999cc; font-weight: bold; color: #000000;}
.php-info .v {background-color: #cccccc; color: #000000;}
.php-info .vr {background-color: #cccccc; text-align: right; color: #000000;}
.php-info img {float: right; border: 0px;}
.php-info hr {width: 100%; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
.php-info p {margin-bottom: 10px;}
</style>
EOT;

		otx_html_add_navtab($this->_('navtab_index_title'), $this->_('navtab_index_desc'), otx_router_url('index'), true);
		otx_html_add_breadcrumb($this->_('breadcrumb_index'));
		otx_html_response_title($this->_('breadcrumb_index'));

		otx_html_add_child($php_style);
		otx_html_add_child(otx_html_tag_simple('div', otx_string_search($php_info, '<div class="center">', '</div>'), array('class' => 'php-info')));
	}
}